home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / language / harvest.cpt / Harvest C / DDefine.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-16  |  1.6 KB  |  65 lines

  1. /*
  2.     Harvest C
  3.     Copyright 1992 Eric W. Sink.  All rights reserved.
  4.     
  5.     This file is part of Harvest C.
  6.     
  7.     Harvest C is free software; you can redistribute it and/or modify
  8.     it under the terms of the GNU Generic Public License as published by
  9.     the Free Software Foundation; either version 2, or (at your option)
  10.     any later version.
  11.     
  12.     Harvest C is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.     GNU General Public License for more details.
  16.     
  17.     You should have received a copy of the GNU General Public License
  18.     along with Harvest C; see the file COPYING.  If not, write to
  19.     the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.     
  21.     Harvest C is not in any way a product of the Free Software Foundation.
  22.     Harvest C is not GNU software.
  23.     Harvest C is not public domain.
  24.  
  25.     This file may have other copyrights which are applicable as well.
  26.  
  27. */
  28.  
  29. /*
  30.     DDefine.c
  31. */
  32.  
  33. #include "DDefine.h"
  34. #include "DToken.h"
  35. #include "DTokenStream.h"
  36. #include "CSymbolList.h"
  37.  
  38. void DDefine::Expand(DTokenStream *into,CSymbolList *beingExpanded)
  39. {
  40.     /* For each aToken in expansion, call into->Add(aToken,beingExpanded) */
  41.     int i;
  42.     long countTokens;
  43.     DToken *aToken;
  44.     
  45.     beingExpanded->Append((void *) this);
  46.     countTokens = expansion->GetNumItems();
  47.     for (i=1;i<=countTokens;i++) {
  48.         aToken = expansion->GetNthToken(i);
  49.         into->Add(aToken,beingExpanded);
  50.     }
  51.     beingExpanded->Remove((void *) this);
  52. }
  53.  
  54. void DDefine::IDefine(DTokenStream *theExpansion)
  55. {
  56.     expansion = theExpansion;
  57. }
  58.  
  59. void DDefine::Dispose(void)
  60. {
  61.     ForgetObject(expansion);
  62.     inherited::Dispose();
  63. }
  64.  
  65.